package components.dialogs.brush
{
	import UIFree.ObjectEvent;
	import UIFree.command.uif_commandManager;
	import UIFree.uif_component;
	
	import classes.Commands.c_applyBrush;
	import classes.Commands.c_enterBrushMode;
	
	import components.brush.c_baseBrush;
	import components.dialogs.c_propertyDialog;
	
	public class c_baseBrushParams extends c_propertyDialog {
		private var _brush: c_baseBrush;
		public function c_baseBrushParams(parent: uif_component, a_brush: c_baseBrush, a_title: String='') {
			super(parent, propertyList(a_brush), a_title, false);
			_brush = a_brush;
		}
		
		protected function doCanExecute(e: ObjectEvent): void {
			if (!(e.object.command is c_applyBrush) && !(e.object.command is c_enterBrushMode)) {
				e.object.result = false;
			}
		}
		
		override protected function listenEvents():void {
			super.listenEvents();
			addEvent(uif_commandManager.CANEXECUTE, doCanExecute, cl.workspace);
		}
		
		protected function get brush(): c_baseBrush {
			return _brush;
		}
		
		protected function propertyList(a_brush: c_baseBrush):Array {
			return [];
		}
	}
}